package io.kiki.sba.registry.common.model.metaserver.nodes;

import io.kiki.sba.registry.common.model.ClientInterfaceId;
import io.kiki.sba.registry.common.model.store.Url;
import lombok.Getter;


@Getter
public class ClientInterfaceNode extends AbstractNode {

    private final ClientInterfaceId clientInterfaceId;

    // session weight for client conn load balance
    private int weight;


    public ClientInterfaceNode(Url nodeUrl, String regionId, ClientInterfaceId clientInterfaceId, int weight) {
        super(null, nodeUrl, regionId);
        this.clientInterfaceId = clientInterfaceId;
        this.weight = weight;
    }

    @Override
    public NodeType getNodeType() {
        return NodeType.client_interface;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof ClientInterfaceNode)) {
            return false;
        }

        ClientInterfaceNode that = (ClientInterfaceNode) o;
        return equal(that);
    }


    @Override
    public int hashCode() {
        return super.hash();
    }
}
